﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Data.Linq.Mapping;
using System.ComponentModel;

namespace NutriLeaf.Phone.Model
{
    [Table]
    public class User: INotifyPropertyChanged,INotifyPropertyChanging
    {
        private int userId, version,roleId;
        private string userName,email,accessToken,sessionKey,locale;
        private DateTime dateTimeStamp, dateTimeUpdated,expires;
        private bool userActivated, userBlocked;


        [Column(IsPrimaryKey = true)]
        public int UserID
        {
            get
            {
                return userId;
            }
            set
            {
                NotifyPropertyChanging("UserID");
                userId = value;
                NotifyPropertyChanged("UserID");
            }

        }


        [Column]
        public int Version
        {
            get
            {
                return version;
            }
            set
            {
                NotifyPropertyChanging("Version");
                version = value;
                NotifyPropertyChanged("Version");
            }

        }

        [Column]
        public int RoleID
        {
            get
            {
                return roleId;
            }
            set
            {
                NotifyPropertyChanging("RoleID");
                roleId = value;
                NotifyPropertyChanged("RoleID");
            }

        }

        [Column]
        public string Username
        {
            get
            {
                return userName;
            }
            set
            {
                NotifyPropertyChanging("Username");
                userName = value;
                NotifyPropertyChanged("Username");
            }

        }

        [Column]
        public string Email
        {
            get
            {
                return email;
            }
            set
            {
                NotifyPropertyChanging("Email");
                email = value;
                NotifyPropertyChanged("Email");
            }

        }

        

        [Column]
        public string AccessToken
        {
            get
            {
                return accessToken;
            }
            set
            {
                NotifyPropertyChanging("AccessToken");
                accessToken = value;
                NotifyPropertyChanged("AccessToken");
            }

        }

        [Column]
        public string Locale
        {
            get
            {
                return locale;
            }
            set
            {
                NotifyPropertyChanging("Locale");
                locale = value;
                NotifyPropertyChanged("Locale");
            }

        }

        [Column]
        public string SessionKey
        {
            get
            {
                return sessionKey;
            }
            set
            {
                NotifyPropertyChanging("SessionKey");
                sessionKey = value;
                NotifyPropertyChanged("SessionKey");
            }

        }

        [Column]
        public DateTime DateTimeStamp
        {
            get
            {
                return dateTimeStamp;
            }
            set
            {
                NotifyPropertyChanging("DateTimeStamp");
                dateTimeStamp = value;
                NotifyPropertyChanged("DateTimeStamp");
            }

        }

        [Column]
        public DateTime DateTimeUpdated
        {
            get
            {
                return dateTimeUpdated;
            }
            set
            {
                NotifyPropertyChanging("DateUpdated");
                dateTimeUpdated = value;
                NotifyPropertyChanged("DateUpdated");
            }

        }


        [Column]
        public DateTime Expires
        {
            get
            {
                return expires;
            }
            set
            {
                NotifyPropertyChanging("Expires");
                expires = value;
                NotifyPropertyChanged("Expires");
            }

        }

        [Column]
        public bool UserActivated
        {
            get
            {
                return userActivated;
            }
            set
            {
                NotifyPropertyChanging("UserActivated");
                userActivated = value;
                NotifyPropertyChanged("UserActivated");
            }

        }

        [Column]
        public bool UserBlocked
        {
            get
            {
                return userBlocked;
            }
            set
            {
                NotifyPropertyChanging("UserBlocked");
                UserBlocked = value;
                NotifyPropertyChanged("UserBlocked");
            }

        }

        public event PropertyChangedEventHandler PropertyChanged;

        public event PropertyChangingEventHandler PropertyChanging;

        private void NotifyPropertyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } }
        private void NotifyPropertyChanging(string propertyName) { if (PropertyChanging != null) { PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); } }
    }
}
